from cStringIO import StringIO
from aswhois import aswhois
import csv

output = open('449as.csv', 'w')
w = csv.writer(output)
doc_string = open('449as.txt').read()
doc = StringIO(doc_string)
a = aswhois()
for line in doc:
	asn = line.strip()
	a.search(asn)
	w.writerow((asn, a.aut_num, a.as_name, a.descr, a.country))
output.close()
